package ee.serge.client.content.article;

import com.google.gwt.user.client.ui.HTML;

import ee.serge.client.Move;
import ee.serge.client.content.cp.article.ArticlesContent;
import ee.serge.service.Service;
import ee.serge.shared.Article;
import ee.serge.util.Content;
import ee.serge.util.SimpleCallback;
import ee.serge.util.URLData;

public class KnowYourRightsContent extends Content {
   private static final String NAME = "know_your_rights";
   
   public static String getName() {
      return NAME;
   }
   
   public static URLData getURLData() {
      URLData data = new URLData();
      data.setName(NAME);
      return data;
   }
   
   public static void show() {
      Service.getArticleService().getArticle(ArticlesContent.TYPE_LOANERS_RIGHTS, new SimpleCallback<Article>() {

         @Override
         public void success(Article result) {
            Move.get().setContent(new KnowYourRightsContent(result));
         }
      });
   }
   
   public KnowYourRightsContent(Article result) {
      buildPanel(result);
   }
   
   private void buildPanel(Article article) {
      setHeader("Know your rights");
      
      add(new HTML(article.getText()));
   }
   
}